﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace VirtualOrg.Web
{
    public partial class FormUpdateOrg : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                GetCategories();
            }
        }

        private void GetOrganizationMainDetails()
        {
            using (DB.DbStoreDataContext dataContext = new DB.DbStoreDataContext())
            {
                
            }
        }

        private void GetCategories()
        {
            using (DB.DbStoreDataContext dataContext = new DB.DbStoreDataContext())
            {
                ddlCategory.DataSource = dataContext.GetCategories("ORG_TYPE");
                ddlCategory.DataTextField = "Title";
                ddlCategory.DataValueField = "CategoryID";
                ddlCategory.DataBind();
                ddlCategory.Items.Add("Other");
                ddlCategory.Items.Insert(0, "");
            }
        }

        private void GetSubCategories(long categoryId)
        {
            using (DB.DbStoreDataContext dataContext = new DB.DbStoreDataContext())
            {
                ddlSubCategory.DataSource = dataContext.GetSubCategories(categoryId);
                ddlSubCategory.DataTextField = "Title";
                ddlSubCategory.DataValueField = "SubCategoryID";
                ddlSubCategory.DataBind();
                ddlSubCategory.Items.Insert(0, "");
            }
        }
    }
}